<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of EnderecoDAOClass
 *
 * @author Gustavo
 */
include_once 'ConfigClass.php';
include_once '../negocios/EnderecoClass.php';
class EnderecoDAOClass {
    private $conn;
    private $user;

    public function  __construct() {
        $this->conn = new ConfigClass();
    }

    public function  __destruct() {

    }

    public function cadastraEndereco(EnderecoClass $endereco, CidadeClass $cidade, UsuarioDAOClass $usuario){
        $this->conn->conecta();

        $usuario = $usuario->get_Id_usuario($login);
        $query = "INSERT INTO endereco (endereco, complemento, cep, id_cidade, id_usuario)
            VALUES ('".$endereco->getEndereco()."','".$endereco->getComplemento()."','".$endereco->getCep()."', '".$cidade->getId_cidade()."','".$usuario."')";

        $res = pg_query($query);
        
        $this->conn->desconecta();
    }
}
?>
